package com.mapull.primitive;

/**
 * @author Mapull
 * @date 2024-04-05
 */
public class SimpleLong {

    public static void main(String[] args) {
        Long num1 = Long.valueOf("123AF", 16);
        System.out.println(num1);
        Long num2 = Long.valueOf("-110", 2);
        System.out.println(num2);
        Long num3 = Long.valueOf("89", 8);
    }
    public static void main21(String[] args) {
        Long num1 = Long.valueOf("129");
        Long num2 = Long.valueOf(129);
        System.out.println(num1.equals(num2));
        System.out.println(num1 == num2);
    }
    public static void main20(String[] args) {
        Long num1 = Long.valueOf(12345);
        Long num2 = Long.valueOf(-12345);
    }
    public static void main19(String[] args) {
        Long num1 = new Long("12345");
        String str1 = Long.toString(num1, 32);
        String str2 = Long.toString(num1, 40);
        String str3 = Long.toString(num1, 10);
        System.out.println(str1);
        System.out.println(str2);
        System.out.println(str3);
        Long num2 = new Long("-123");
        String str4 = Long.toString(num2, 16);
        System.out.println(str4);
    }

    public static void main18(String[] args) {
        Long num1 = new Long("12");
        String str = Long.toString(num1);
    }
    public static void main17(String[] args) {
        Long num1 = new Long("12");
        String str = num1.toString();
    }

    public static void main16(String[] args) {
        Long num1 = new Long("12");
        String str1 = Long.toOctalString(num1);
        System.out.println(str1);

        Long num2 = new Long("0");
        String str2 = Long.toOctalString(num2);
        System.out.println(str2);

        Long num3 = new Long("-1234567");
        String str3 = Long.toOctalString(num3);
        System.out.println(str3);
    }

    public static void main15(String[] args) {
        Long num1 = new Long("12");
        String str1 = Long.toHexString(num1);
        System.out.println(str1);

        Long num2 = new Long("0");
        String str2 = Long.toHexString(num2);
        System.out.println(str2);

        Long num3 = new Long("-1234567");
        String str3 = Long.toHexString(num3);
        System.out.println(str3);
    }

    public static void main14(String[] args) {
        Long num1 = new Long("12");
        String str1 = Long.toBinaryString(num1);
        System.out.println(str1);

        Long num2 = new Long("0");
        String str2 = Long.toBinaryString(num2);
        System.out.println(str2);


        Long num3 = new Long("-1234567");
        String str3 = Long.toBinaryString(num3);
        System.out.println(str3);
    }

    public static void main13(String[] args) {
        Long num1 = new Long("12");
        short value = num1.shortValue();
        System.out.println(value);
        Long num2 = Long.MAX_VALUE;
        short value2 = num2.shortValue();
        System.out.println(value2);
    }

    public static void main12(String[] args) {
        long num1 = Long.parseLong("12345", 10);
        long num2 = Long.parseLong("12345", 8);
        long num3 = Long.parseLong("-1234AF", 16);
        System.out.println(num1);
        System.out.println(num2);
        System.out.println(num3);
    }

    public static void main11(String[] args) {
        long num1 = Long.parseLong("12345");
        long num2 = Long.parseLong("+12345");
        long num3 = Long.parseLong("-12345");
        long num4 = Long.parseLong("12345L"); // java.lang.NumberFormatException
    }

    public static void main10(String[] args) {
        Long num1 = new Long("12");
        long value = num1.longValue();
        System.out.println(value);
        Long num2 = Long.MAX_VALUE;
        long value2 = num2.longValue();
        System.out.println(value2);
    }

    public static void main9(String[] args) {
        Long num1 = new Long("12");
        int value = num1.intValue();
        System.out.println(value);
        Long num2 = Long.MAX_VALUE;
        int value2 = num2.intValue();
        System.out.println(value2);
    }

    public static void main8(String[] args) {
        Long num1 = new Long("12");
        float value = num1.floatValue();
        System.out.println(value);
        Long num2 = Long.MAX_VALUE;
        float value2 = num2.floatValue();
        System.out.println(value2);
    }

    public static void main7(String[] args) {
        Long num1 = new Long("12345");
        Long num2 = new Long(12345);
        boolean bool1 = num1.equals(num2);
        boolean bool2 = num1.equals(null);
        System.out.println("Long 数值 " +num1+ " 与 " + num2 +" 是否相等 "+bool1);
        System.out.println("Long 数值 " +num1+ " 与 null 是否相等 "+bool2);
    }

    public static void main6(String[] args) {
        Long num1 = new Long("12");
        double value = num1.doubleValue();
        System.out.println(value);
        Long num2 = Long.MAX_VALUE;
        double value2 = num2.doubleValue();
        System.out.println(value2);
    }

    public static void main5(String[] args) {
        Long num1 = new Long("12");
        byte b = num1.byteValue();
        System.out.println(b);
        Long num2 = new Long(12345);
        byte b1 = num2.byteValue();
        System.out.println(b1);
    }
    public static void main4(String[] args) {
        String str = "12345";
        Long num1 = Long.decode(str);
        System.out.println(num1);
        String str2 = "1024M";
        Long num2 = Long.decode(str2);
    }

    public static void main3(String[] args) {
        Long num1 = new Long("12345");
        Long num2 = new Long(12345);
        Long num3 = new Long(123456L);
        int val = num1.compareTo(num2);
        System.out.println("Long 类型数值 " + num1 + " 与 " + num2 + " compareTo " + val);
        int val2 = num1.compareTo(num3);
        System.out.println("Long 类型数值 " + num1 + " 与 " + num3 + " compareTo " + val2);
    }

    public static void main2(String[] args) {
        System.out.println(Long.MAX_VALUE);
        System.out.println(Long.MIN_VALUE);
        System.out.println(Long.SIZE);
        System.out.println(Long.BYTES);
    }
    public static void main0(String[] args) {
        Long num1 = new Long("12345");
        Long num2 = new Long(12345);
        Long num3 = new Long(12345L);
        System.out.println(num1);
        System.out.println(num2);
        System.out.println(num3);
    }
}
